package com.fp.m7.model;

import java.io.Serializable;

import org.springframework.data.neo4j.annotation.GraphId;

public abstract class EntityBase implements com.fp.m7.api.model.EntityBase,
		Serializable {

	private static final long serialVersionUID = 5570492061802807548L;

	@GraphId
	protected Long id;

	protected Long auditCD;

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public void setId(Serializable id) {
		this.id = (Long) id;
	}

	public Long getAuditCD() {
		return auditCD;
	}

	public void setAuditCD(Long auditCD) {
		this.auditCD = auditCD;
	}

	@Override
	public String toString() {
		return new StringBuilder("EntityBase [id=").append(id)//
				.append("; auditCD=").append(auditCD).append("]").toString();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof EntityBase) {
			EntityBase that = (EntityBase) obj;
			return that.id != null && that.id.equals(this.id);
		}
		return false;
	}

	@Override
	public int hashCode() {
		return id == null ? 0 : id.intValue() * 317;
	}
}
